<template>
  <a-card :bordered="false" class="card-area">
    <div :class="advanced ? 'search' : null">
      <!-- 搜索区域 -->
      <a-form layout="horizontal">
        <div :class="advanced ? null: 'fold'">
          <a-row>
            <a-col :md="12" :sm="24">
              <a-form-item
                label="法人行"
                :labelCol="{span: 5}"
                :wrapperCol="{span: 18, offset: 1}">
                <a-select
                          mode="default"
                          :allowClear="true"
                          style="width: 100%"
                          @change="handleInstChange"
                          v-model="queryParams.instId">
                  <a-select-option v-for="r in instIdData" :key="r.label">{{r.label}}-{{r.value}}</a-select-option>
                </a-select>
<!--                <a-input v-if="!this.user.admin" v-model="queryParams.instId" :value="this.user.instId"
                         readonly="readonly"/>-->
              </a-form-item>
            </a-col>
          </a-row>
          <a-row v-show="queryParams.instId!=''">
            <a-col :md="12" :sm="24">
              <a-form-item
                label="商户组别"
                :labelCol="{span: 5}"
                :wrapperCol="{span: 18, offset: 1}">
                <a-select
                  show-search
                  placeholder="请输入代码或名称"
                  option-filter-prop="children"
                  style="width: 100%"
                  :filter-option="filterOption"
                  @focus="getMerchantTypeGroups"
                  @search="getMerchantTypeGroups"
                  @change="handleInstChangeM"
                  v-model="queryParams.grpNo"
                >
                  <a-select-option v-for="(d,index) in merchantTypeGroup" :key="d.id">
                    {{d.name}}
                  </a-select-option>
                </a-select>
              </a-form-item>
            </a-col>
            <a-col :md="12" :sm="24">
              <a-form-item
                label="商户MCC"
                :labelCol="{span: 5}"
                :wrapperCol="{span: 18, offset: 1}">
                <a-select
                  show-search
                  placeholder="请输入代码或名称"
                  option-filter-prop="children"
                  style="width: 100%"
                  :filter-option="filterOption"
                  @focus="getMerchantTypes"
                  @search="getMerchantTypes"
                  @change="handleInstChangeI"
                  v-model="queryParams.industryType"
                >
                  <a-select-option v-for="(d,index) in merchantType" :key="d.industryType">
                    {{d.industryType}}-{{d.industryName}}
                  </a-select-option>
                </a-select>
              </a-form-item>
            </a-col>
          </a-row>

        </div>
        <div style="text-align: center;" v-show="queryParams.instId!=''">
          <a-button type="primary" @click="search">查询</a-button>
          <a-button style="margin-left: 8px" @click="reset">重置</a-button>
        </div>
      </a-form>
    </div>
    <div v-show="queryParams.instId!=''">
      <!-- 表格区域 -->
      <div class="operator">
        <a-button v-hasPermission="['bankLevelManager:add']" ghost type="primary" @click="addBankLevelManager">新增</a-button>
        <a-button v-hasPermission="['bankLevelManager:use']" ghost type="primary" @click="stopBankLevelManager">停用</a-button>
        <a-button v-hasPermission="['bankLevelManager:stop']" ghost type="primary" @click="useBankLevelManager">启用</a-button>
        <a-button v-hasPermission="['bankLevelManager:cancel']" ghost type="primary" @click="cancelBankLevelManager">注销</a-button>
        <a-button v-hasPermission="['bankLevelManager:import']" ghost type="primary" @click="uploadBankLevelManager">导入</a-button>
      </div>
      <a-table ref="TableInfo"
               :columns="columns"
               :rowKey="record => record.id"
               :dataSource="dataSource"
               :pagination="pagination"
               :loading="loading"
               :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
               :scroll="{ x: 2600 }"
               @change="handleTableChange">
        <template slot="email" slot-scope="text, record">
          <a-popover placement="topLeft">
            <template slot="content">
              <div>{{text}}</div>
            </template>
            <p style="width: 150px;margin-bottom: 0">{{text}}</p>
          </a-popover>
        </template>
        <template slot="bankLevelManagerOperation" slot-scope="text, record">
          <a-icon v-hasPermission="['bankLevelManager:edit']" type="setting" theme="twoTone" twoToneColor="#4a9ff5"
                  @click="editBankLevelManager(record)" title="修改"></a-icon>&nbsp;
          <a-icon v-hasPermission="['bankLevelManager:view']" type="eye" theme="twoTone" twoToneColor="#42b983"
                  @click="viewBankLevelManager(record)" title="查看"></a-icon>
          <a-badge v-hasNoPermission="['bankLevelManager:edit','bankLevelManager:view']" userStatus="warning" text="无权限"></a-badge>
        </template>

      </a-table>
      <!-- 查看 -->
      <bank-level-manager-info
        ref="bankLevelManagerInfo"
        @close="handleBankLevelManagerInfoClose"
        :bankLevelManagerInfoVisiable="bankLevelManagerInfo.visiable">
      </bank-level-manager-info>

      <!-- 新增 -->
      <bank-level-manager-add
        @close="handleBankLevelManagerAddClose"
        @success="handleBankLevelManagerAddSuccess"
        :bankLevelManagerAddVisiable="bankLevelManagerAdd.visiable"
        :instId="this.queryParams.instId">
      </bank-level-manager-add>


      <!-- 修改 -->
      <bank-level-manager-edit
        ref="bankLevelManagerEdit"
        @close="handleBankLevelManagerEditClose"
        @success="handleBankLevelManagerEditSuccess"
        :bankLevelManagerEditVisiable="bankLevelManagerEdit.visiable"
        :instId="this.queryParams.instId">
      </bank-level-manager-edit>

      <!-- 导入 -->
      <bank-level-manager-import
        ref="bankLevelManagerImport"
        @close="handleBankLevelManagerImportClose"
        :bankLevelManagerImportVisiable="bankLevelManagerImport.visiable"
        :instId="this.queryParams.instId">
      </bank-level-manager-import>
    </div>

    <div>
      <a-modal
        title="确认操作"
        :visible="stopShow"
        @ok="stopOk(recordTemp)"
        @cancel="handleCancel"
      >
        {{ modalText }}
      </a-modal>
      <a-modal
        title="确认操作"
        :visible="useShow"
        @ok="useOk(recordTemp)"
        @cancel="handleCancel"
      >
        {{ modalText }}
      </a-modal>
      <a-modal
        title="确认操作"
        :visible="cancelShow"
        @ok="cancelOk(recordTemp)"
        @cancel="handleCancel"
      >
        {{ modalText }}
      </a-modal>
    </div>
  </a-card>
</template>

<script>
  import RangeDate from '@/components/datetime/RangeDate';
  import {mapState} from "vuex"
  import BankLevelManagerAdd from "./BankLevelManagerAdd";
  import BankLevelManagerEdit from "./BankLevelManagerEdit";
  import BankLevelManagerImport from "./BankLevelManagerImport";
  import BankLevelManagerInfo from "./BankLevelManagerInfo";


  export default {
    name: "BankLevelManager",
    inject: ['merchantBaseInfoContext', 'operationContext'],
    components: {BankLevelManagerImport, BankLevelManagerEdit, BankLevelManagerAdd, BankLevelManagerInfo, RangeDate},
    data() {
      return {
        inputFetching : false,
        stopShow: false,
        useShow: false,
        cancelShow: false,
        modalText: '',
        recordTemp: {},
        grpNoData: [],
        industryTypeData: [],
        merchantTypeGroup: [], // 商户组别下拉框数据
        merchantType: [], // 商户类别下拉框数据
        advanced: false,
        grpNo: '',
        bankLevelManagerInfo: {
          visiable: false,
          data: {}
        },
        bankLevelManagerAdd: {
          visiable: false
        },
        bankLevelManagerEdit: {
          visiable: false
        },
        bankLevelManagerImport: {
          visiable: false
        },
        queryParams: {
          instId: '',
          grpNo: '',
          industryType: '',
        },
        dataSource: [],
        sortedInfo: null,
        paginationInfo: null,
        selectedRowKeys: [],
        pagination: {
          pageSizeOptions: ['10', '20', '30', '40', '100'],
          defaultCurrent: 1,
          defaultPageSize: 10,
          showQuickJumper: true,
          showSizeChanger: true,
          showTotal: (total, range) => `显示 ${range[0]} ~ ${range[1]} 条记录，共 ${total} 条记录`
        },
        loading: false,
        instIdData: [],
        da: []
      }
    },
    computed: {
      ...mapState({
        user: state => state.account.user,

      }),
      columns() {
        let {sortedInfo} = this
        sortedInfo = sortedInfo || {}
        let {filteredInfo} = this
        filteredInfo = filteredInfo || {}
        return [{
          title: '商户组别编码',
          dataIndex: 'grpNo',
          scopedSlots: {customRender: 'grpNo'},
        }, {
          title: '商户组别名称',
          dataIndex: 'grpDesc',
          scopedSlots: {customRender: 'grpDesc'},
        }, {
          title: 'MCC编码',
          dataIndex: 'industryType',
          scopedSlots: {customRender: 'industryType'},
        }, {
          title: 'MCC名称',
          dataIndex: 'industryName',
          scopedSlots: {customRender: 'industryName'},
        }, {
          title: '单笔借记限额(元)',
          dataIndex: 'singleLimitLoanMaxAmt',
          scopedSlots: {customRender: 'singleLimitLoanMaxAmt'},
        }, {
          title: '单笔贷记限额(元)',
          dataIndex: 'singleLimitCreditMaxAmt',
          scopedSlots: {customRender: 'singleLimitCreditMaxAmt'},
        }, {
          title: '日累计借记限额(元)',
          dataIndex: 'dayLimitLoanAmt',
          scopedSlots: {customRender: 'dayLimitLoanAmt'},
        }, {
          title: '日累计贷记限额(元)',
          dataIndex: 'dayLimitCreditAmt',
          scopedSlots: {customRender: 'dayLimitCreditAmt'},
        }, {
          title: '月累计借记限额(元)',
          dataIndex: 'monthLimitLoanAmt',
          scopedSlots: {customRender: 'monthLimitLoanAmt'},
        }, {
          title: '月累计贷记限额(元)',
          dataIndex: 'monthLimitCreditAmt',
          scopedSlots: {customRender: 'monthLimitCreditAmt'},
        }, {
          title: '日累计限额',
          dataIndex: 'dayLimitAmt',
          scopedSlots: {customRender: 'dayLimitAmt'},
        },{
          title: '月累计限额',
          dataIndex: 'monthLimitAmt',
          scopedSlots: {customRender: 'monthLimitAmt'},
        }, {
          title: '状态',
          dataIndex: 'status',
          customRender: (text, row, index) => {
            switch (text) {
              case 'Y':
                return <a-tag color = "cyan" > 启用 < /a-tag>
              case 'N':
                return <a-tag color = "pink" > 停用 < /a-tag>
              default:
                return text
            }
          },
          filters: [
            {text: '启用', value: 'Y'},
            {text: '停用', value: 'N'},
          ],
          filterMultiple: false,
          filteredValue: filteredInfo.status || null,
          onFilter: (value, record) => record.status.includes(value)
        }, {
          title: '审核状态',
          dataIndex: 'auditStatus',
          customRender: (text, row, index) => {
            switch (text) {
              case '00':
                return <a-tag color = "cyan" > 待提交审批 < /a-tag>
              case '01':
                return <a-tag color = "pink" > 新增-审批流程中 < /a-tag>
              case '02':
                return <a-tag color = "pink" > 新增-审批通过 < /a-tag>
              case '03':
                return <a-tag color = "pink" > 新增-审批拒绝 < /a-tag>
              case '11':
                return <a-tag color = "cyan" > 注销-审批流程中 < /a-tag>
              case '12':
                return <a-tag color = "pink" > 注销-审批通过 < /a-tag>
              case '13':
                return <a-tag color = "pink" > 注销-审批拒绝 < /a-tag>
              case '21':
                return <a-tag color = "pink" > 停用-审批流程中 < /a-tag>
              case '22':
                return <a-tag color = "cyan" > 停用-审批通过 < /a-tag>
              case '23':
                return <a-tag color = "pink" > 停用-审批拒绝 < /a-tag>
              case '31':
                return <a-tag color = "pink" > 启用-审批流程中 < /a-tag>
              case '32':
                return <a-tag color = "pink" > 启用-审批通过 < /a-tag>
              case '33':
                return <a-tag color = "cyan" > 启用-审批拒绝 < /a-tag>
              case '41':
                return <a-tag color = "pink" > 修改-审批流程中 < /a-tag>
              case '42':
                return <a-tag color = "pink" > 修改-审批通过 < /a-tag>
              case '43':
                return <a-tag color = "pink" > 修改-审批拒绝 < /a-tag>
              default:
                return text
            }
          },
          filters: [
            {text: '待提交审批', value: '00'},
            {text: '新增-审批流程中', value: '01'},
            {text: '新增-审批通过', value: '02'},
            {text: '新增-审批拒绝', value: '03'},
            {text: '注销-审批流程中', value: '11'},
            {text: '注销-审批通过', value: '12'},
            {text: '注销-审批拒绝', value: '13'},
            {text: '停用-审批流程中', value: '21'},
            {text: '停用-审批通过', value: '22'},
            {text: '停用-审批拒绝', value: '23'},
            {text: '启用-审批流程中', value: '31'},
            {text: '启用-审批通过', value: '32'},
            {text: '启用-审批拒绝', value: '33'},
            {text: '修改-审批流程中', value: '41'},
            {text: '修改-审批通过', value: '42'},
            {text: '修改-审批拒绝', value: '43'}
          ],
          filterMultiple: false,
          filteredValue: filteredInfo.auditStatus || null,
          onFilter: (value, record) => record.auditStatus.includes(value)
        }, {
          title: '操作',
          dataIndex: 'bankLevelManagerOperation',
          fixed: 'right',
          scopedSlots: {customRender: 'bankLevelManagerOperation'}
        }]
      }
    },
    mounted() {
      this.$get('admin/upmporg/getInstList').then((r) => {
        this.instIdData = r.data
      })},
    methods: {
      filterOption(input, option) {
        return (
          option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
        );
        this.fetch();
      },
                  async debounceSearch({value, url, params}) {

                  try {
                  this.inputFetching = true
                  const res = await this.$get(url, params)
                  this.inputFetching = false
                  if (res.status === 200) {
                  return res
                }
                } catch (e) {
                  this.inputFetching = false
                  console.error(e)
                }
                },
                  async getMerchantTypeGroups (value = '') {
                  this.merchantTypeGroup = [];
                  const res = await this.debounceSearch({
                  value,
                  url: '/admin/mcmp/bMchntBaseInfo/unionMerGrpSelect2List',
                  params: {q: encodeURIComponent(value + '&' + this.queryParams.instId)},
                })
                  this.merchantTypeGroup = res.data.rows.map(i => {
                  i.name = i.grpNo + ' - ' + i.grpDesc
                  i.value = i.grpNo
                  return i
                })
                },
                  async getMerchantTypes (value = '') {
                  if (!this.queryParams.grpNo){
                  this.$message.error("请先选择商户组别")
                  return
                }
                  console.log(this.queryParams);
                  this.merchantType = [];
                  const res = await this.debounceSearch({
                  value,
                  url: '/admin/quota/bankLevelManager/mchntFormalSelect2List',
                  params: {q: encodeURIComponent(value + '&' + this.queryParams.instId + '&' + this.queryParams.grpNo)},
                })
                  console.log(res.data);
                  this.merchantType = res.data;
                },

      onSelectChange(selectedRowKeys) {
        this.selectedRowKeys = selectedRowKeys
      },

      handleInstChange(value) {
        this.queryParams.instId=value
                  this.queryParams.grpNo=null
                  this.queryParams.industryType=null
        if (typeof(value) != "undefined" && value != "") {
          this.$get('/admin/quota/bankLevelManager', {
                  instId : this.queryParams.instId
                 }).then((r) => {
            this.dataSource = r.data;
          })
        }
      },

      handleInstChangeM(value) {
      this.queryParams.grpNo=value;
                  this.queryParams.industryType=null;
    },
      handleInstChangeI(value) {
      this.queryParams.industryType=value;
    },
      handleBankLevelManagerEditClose() {
        this.bankLevelManagerEdit.visiable = false
      },
      handleBankLevelManagerEditSuccess() {
        this.bankLevelManagerEdit.visiable = false
        this.$message.success('修改成功')
        this.search()
      },

      handleBankLevelManagerImportClose() {
        this.bankLevelManagerImport.visiable = false
      },
      handleBankLevelManagerImportSuccess() {
        this.bankLevelManagerImport.visiable = false
        this.$message.success('添加成功')
        this.search()
      },
      handleBankLevelManagerAddClose() {
        this.bankLevelManagerAdd.visiable = false
      },
      handleBankLevelManagerAddSuccess() {
        this.bankLevelManagerAdd.visiable = false
        this.$message.success('添加成功')
        this.search()
      },


      viewBankLevelManager(record) {
        this.$refs.bankLevelManagerInfo.setBankLevelManagerFormValues(record)
        this.bankLevelManagerInfo.visiable = true
      },
      handleBankLevelManagerInfoClose() {
        this.bankLevelManagerInfo.visiable = false
      },
      editBankLevelManager(record) {
        if (record.status === '02' ) {
          this.$message.warning('停用的数据不允许再停用')
        } else {
          this.$refs.bankLevelManagerEdit.setBankLevelManagerFormValues(record)
          this.bankLevelManagerEdit.visiable = true
        }
      },

      addBankLevelManager(queryParams) {
        this.bankLevelManagerAdd.visiable = true
      },
      stopBankLevelManager() {
        if (!this.selectedRowKeys.length) {
          this.$message.warning('请选择需要停用的记录')
          return;
        }
        if (this.selectedRowKeys.length > 1) {
          this.$message.warning('请选择一条需要停用的记录')
          return;
        }
        let selectedIndex = ''
        this.dataSource.map((val, index)=>{
          if(val.id === this.selectedRowKeys[0])
          selectedIndex = index;
        })
        const record = this.dataSource[this.selectedRowKeys[0]]
        if (null == record.auditStatus || '' == record.auditStatus || undefined == record.auditStatus) {
          this.$message.warning('该数据审核状态信息异常')
          return
        }
        if (record.auditStatus == "01" || record.auditStatus == "11" || record.auditStatus == "21"
          || record.auditStatus == "31" || record.auditStatus == "41") {
          this.$message.warning('该数据在审批流程中不能进行停用')
          return
        }
        if (record.auditStatus == "22") {
          this.$message.warning('该数据已是停用状态不能进行停用')
          return
        }
        if(record.auditStatus=="12"){
          this.$message.warning('该数据已注销不能进行停用')
          return
        }
        this.recordTemp = record
        this.modalText = '确定要停用组别编号为(' + record.grpNo + ')的限额吗？'
        this.stopShow = true

      },
      useBankLevelManager() {
        if (!this.selectedRowKeys.length) {
          this.$message.warning('请选择需要启用的记录')
          return;
        }
        if (this.selectedRowKeys.length > 1) {
          this.$message.warning('请选择一条需要启用的记录')
          return;
        }
        let selectedIndex = ''
        this.dataSource.map((val, index)=>{
          if(val.id === this.selectedRowKeys[0])
          selectedIndex = index
        })
        const record = this.dataSource[this.selectedRowKeys[0]]

        if (null == record.auditStatus || '' == record.auditStatus || undefined == record.auditStatus) {
          this.$message.warning('该数据审核状态信息异常')
          return
        }
        if (record.auditStatus == "01" || record.auditStatus == "11" || record.auditStatus == "21"
          || record.auditStatus == "31" || record.auditStatus == "41") {
          this.$message.warning('该数据在审批流程中不能进行启用')
          return
        }
        if (record.auditStatus != "33" && record.auditStatus != "22") {
          this.$message.warning('只允许启用“启用-审批拒绝”和“停用-审批通过”的数据')
          return
        }
        this.recordTemp = record
        this.modalText = '确定要启用组别编号为(' + record.grpNo + ')的限额吗？'
        this.useShow = true

      },
      cancelBankLevelManager() {
        if (!this.selectedRowKeys.length) {
          this.$message.warning('请选择需要注销的记录')
          return;
        }
        if (this.selectedRowKeys.length > 1) {
          this.$message.warning('请选择一条需要注销的记录')
          return;
        }
        let selectedIndex = ''
        this.dataSource.map((val, index)=>{
          if(val.id === this.selectedRowKeys[0])
          selectedIndex = index
        })
        const record = this.dataSource[this.selectedRowKeys[0]]
        let auditStatus = record.auditStatus
        if (null == auditStatus || '' == auditStatus || undefined == auditStatus) {
          this.$message.warning('该数据审核状态信息异常')
          return
        }
        if (auditStatus == "01" || auditStatus == "11" || auditStatus == "21" || auditStatus == "31" || auditStatus == "41") {
          this.$message.warning('该数据在审批流程中不能注销')
          return
        }
        if (auditStatus == "12") {
          this.$message.warning('该数据已注销不能进行注销')
          return
        }
                  this.recordTemp = record
                  this.modalText = '确定要注销组别编号为(' + record.grpNo + ')的限额吗？'
                  this.cancelShow = true
      },

      stopOk(recordTemp) {
        // let param = {}
          recordTemp.optFlag = 'stop'
          recordTemp.instId=this.queryParams.instId
        debugger
         this.$put('/admin/quota/bankLevelManager/stopBankMCCquota', recordTemp).then((r) => {
          this.stopShow = false;
          if(r.data.code!="100000"){
                  this.$message.warning(r.data.message)
          }else{
            this.$message.success('商户组别MCC限额停用操作成功')
                  this.search()
                }
        }).catch(() => {
          this.loading = false
        })
      },
      useOk(recordTemp) {
        // let param = {}
        // param.optFlag = 'use'
                  recordTemp.optFlag = 'stop'
        recordTemp.instId=this.queryParams.instId
        this.$put('/admin/quota/bankLevelManager/startBankMCCquota', recordTemp).then((r) => {
        this.useShow = false;
                  if(r.data.code!="100000"){
                  this.$message.warning(r.data.message)
                }else{
                  this.$message.success('商户组别MCC限额启用操作成功')
                  this.search()
                }
        }).catch(() => {
          this.loading = false
        })
      },
      cancelOk(recordTemp) {
        // let param = {}
        // param.optFlag = 'cancel'
                  recordTemp.optFlag = 'cancel'
        recordTemp.instId=this.queryParams.instId
      this.$put('/admin/quota/bankLevelManager/deleteBankMCCquota', recordTemp).then((r) => {
              this.cancelShow = false;
            debugger
                  if(r.data.code!="100000"){
                  this.$message.warning(r.data.message)
                }else{
                  this.$message.success('商户组别MCC限额注销操作成功')
                  this.search()
                }
        }).catch(() => {
          this.loading = false
        })
      },
      handleCancel() {
        this.stopShow = false;
        this.useShow = false;
        this.cancelShow = false;
      },

      uploadBankLevelManager() {
        this.bankLevelManagerImport.visiable = true
      },

      search() {
        this.$refs.TableInfo.pagination.current = this.pagination.defaultCurrent
        if (this.paginationInfo) {
          this.paginationInfo.current = this.pagination.defaultCurrent
          this.paginationInfo.pageSize = this.pagination.defaultPageSize
        }

        this.$refs.TableInfo.pagination.current = this.pagination.defaultCurrent
        if (this.paginationInfo) {
          this.paginationInfo.current = this.pagination.defaultCurrent
          this.paginationInfo.pageSize = this.pagination.defaultPageSize
        }

        let {sortedInfo, filteredInfo} = this
        let sortField, sortOrder
        // 获取当前列的排序和列的过滤规则
        if (sortedInfo) {
          sortField = sortedInfo.field
          sortOrder = sortedInfo.order
        }
        let params = this.queryParams

        this.fetch({
          sortField: sortField,
          sortOrder: sortOrder,
          ...params,
          ...filteredInfo
        })
      },
      reset() {
        // 取消选中
        this.selectedRowKeys = []
        // 重置分页
        this.$refs.TableInfo.pagination.current = this.pagination.defaultCurrent
        if (this.paginationInfo) {
          this.paginationInfo.current = this.pagination.defaultCurrent
          this.paginationInfo.pageSize = this.pagination.defaultPageSize
        }
        // 重置列排序规则
        this.sortedInfo = null
        // 重置查询参数
                  this.queryParams.instId=''
                  // // 清空时间选择
        // this.$refs.createTime.reset()
      //  this.fetch()
      },
      handleTableChange(pagination, filters, sorter) {
                  this.selectedRowKeys = []
        this.$refs.TableInfo.pagination.current = this.pagination.defaultCurrent
        if (this.paginationInfo) {
          this.paginationInfo.current = this.pagination.defaultCurrent
          this.paginationInfo.pageSize = this.pagination.defaultPageSize
        }

        // 将这三个参数赋值给Vue data，用于后续使用
        this.paginationInfo = pagination
        this.filteredInfo = filters
        this.sortedInfo = sorter
        // this.userInfo.visiable = false

        this.fetch({
          sortField: sorter.field,
          sortOrder: sorter.order,
          ...this.queryParams,
          ...filters
        })
      },
      fetch(params = {}) {
        this.loading = true
        if (this.paginationInfo) {
          // 如果分页信息不为空，则设置表格当前第几页，每页条数，并设置查询分页参数
          this.$refs.TableInfo.pagination.current = this.paginationInfo.current
          this.$refs.TableInfo.pagination.pageSize = this.paginationInfo.pageSize
          params.pageSize = this.paginationInfo.pageSize
          params.pageNum = this.paginationInfo.current
        } else {
          // 如果分页信息为空，则设置为默认值
          params.pageSize = this.pagination.defaultPageSize
          params.pageNum = this.pagination.defaultCurrent
        }
        this.$get('/admin/quota/bankLevelManager', {
          ...params
        }).then((r) => {
          let data = r.data
          const pagination = {...this.pagination}
          pagination.total = data.total
          this.dataSource = data
          this.pagination = pagination
          this.loading = false
        })
      },
    }
  }
</script>

<style lang="less" scoped>
  @import "../../../../../../static/less/Common";
</style>

